#include<stdio.h>
#include<string.h>
#define maxn 15

int main()
{
	int a[maxn][maxn],n,x,y,t=1;
	scanf("%d",&n);
	memset(a,0,sizeof(a));
	a[x=0][y=n-1]=t;
	while (t<n*n)
	{
		while (x+1<n&&!a[x+1][y])
			a[++x][y]=++t;
		while (y-1>=0&&!a[x][y-1])
			a[x][--y]=++t;
		while (x-1>=0&&!a[x-1][y])
			a[--x][y]=++t;
		while (y+1<n&&!a[x][y+1])
			a[x][++y]=++t;
	}
	for (x=0;x<n;x++)
	{
		for (y=0;y<n;y++)
			printf("%5d",a[x][y]);
		printf("\n");
	}
	return 0;
} 
